package com.wg.springbootservlet;

import com.wg.springbootservlet.two.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:
 * @Author WuGang
 * @Date 2021/10/20 20:03
 * @Version 1.0
 */
@Configuration
public class ServletConfig {
    @Bean  //这种方式不需要在入口类扫描 因为又Configuration
//    该注解主要用在配置类里面  相当于一个<beans>标签
//    这里相当于web.xml里面的标签   相当于serclet注册进来的bean对象
    public ServletRegistrationBean  myServletRegistrationBean(){
        ServletRegistrationBean myservlet2 = new ServletRegistrationBean(new MyServlet(), "/myservlet2");
        return myservlet2;
    }
}
